<?php

namespace app\admin\validate;

use think\Validate;

class AccountValidate extends Validate
{
    protected $rule = [
        'password'      => 'require',
        'password_new'  => 'require',
        'password_again'=> 'require|passwordAgain',
    ];

    protected $message  =   [
        'password.require'  => '请输入老密码',
        'password_new.require' => '请输入新密码',
        'password_again.passwordAgain' => '两次密码不一致',
    ];

    // 验证验证码是否正确
    protected function passwordAgain($value, $rule, $data)
    {
        return $value === $data['password_new'];
    }
}